package com.hc.model.code04.test10.white_box;

/**
 * @version v1.0
 * @ClassName: Client
 * @Description: 白箱备忘录案例测试
 * @Author: HC
 */
public class Client {

    public static void main(String[] args) {
        System.out.println("----------------大战boos之前---------------");
        GameRole gameRole = new GameRole();
        // 角色初始化
        gameRole.initState();
        // 打印角色状态
        gameRole.stateDisplay();

        // 记录角色当前状态
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(gameRole.saveState());

        System.out.println("----------------大战boos之后---------------");
        // 决战后修改角色状态
        gameRole.fight();
        gameRole.stateDisplay();

        System.out.println("----------------恢复之前的状态---------------");

        // 恢复角色状态
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());
        gameRole.stateDisplay();

    }
}
